<template>
	<view class='page_cont' :style="{background:type==1?'#fff':'#000'}">
		<image class='img' :src='url' :style="{paddingTop:height+'px',paddingBottom:height+'px'}" mode="widthFix" @load="load_image"></image>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				url: '',
				page: '',
				height: '',
				type: 1
			}
		},
		onLoad(options) {
			uni.showLoading({})
			uni.setNavigationBarTitle({title: options.title});
			this.url=options.url;
			this.page=options.page;
		},
		methods:{
			load_image(e){
				uni.hideLoading()
				var sysinfo=uni.getSystemInfoSync();
				var height=e.detail.height/e.detail.width*sysinfo.windowWidth;
				if(height<sysinfo.windowHeight){
					this.height=(sysinfo.windowHeight-height)/2;
					this.type=2
					uni.setNavigationBarColor({
						frontColor: '#ffffff',
						backgroundColor: '#000000'
					})
				}
			}
		}
	}
</script>

<style lang="scss">
	.page_cont{
		width: 100%;
		.img{
			width: 100%;
			display: block;
		}
	}
</style>
